#ifndef _N2F_ELEMENT_H_
#define _N2F_ELEMENT_H_

#include "core.h"

enum N2FScaleGroup
{
	ScaleGroupRelative,
	ScaleGroupAbsolute
};

enum N2FOriginPoint
{
	PointOriginTopLeft,
	PointOriginTopCenter,
	PointOriginTopRight,
	PointOriginMidLeft,
	PointOriginMidCenter,
	PointOriginMidRight,
	PointOriginBotLeft,
	PointOriginBotCenter,
	PointOriginBotRight
};

namespace N2F
{
	namespace Iw3D
	{
		class Element
		{
		public:
			Element(const ScaleFactor &scaleFactor);
			~Element();

			const ScaleFactor getScaleFactor() const;
			void setScaleFactor(const ScaleFactor &scaleFactor);

			const N2FScaleGroup getScaleGroup() const;
			void setScaleGroup(N2FScaleGroup group);

			const N2FOriginPoint getOriginPoint() const;
			void setOriginPoint(N2FOriginPoint originPoint);

			void setPositioningMetrics(N2FScaleGroup group, N2FOriginPoint point);

			const CIwFVec2 getPosition() const;
			void setPosition(CIwFVec2 pos);
			void setPosition(float x, float y);

			const CIwFVec2 getSize() const;
			void setSize(CIwFVec2 size);

			const bool getVisible() const;
			void setVisible(bool isVisible);

			const bool getActive() const;
			void setActive(bool isActive);

			void kill();
			virtual void draw(int64 delta) = 0; 
			virtual bool isHit(CIwFVec2 point) = 0;

			virtual void move(float x, float y);
			virtual void move(CIwFVec2 move);

			virtual void OnKill();
			virtual void OnTouch(InputPoint point);
			virtual void OnKey(InputKey key);

		protected:
			virtual CIwFVec2 translateSize();
			virtual CIwFVec2 translateSize(float scale);
			virtual CIwFVec2 translatePosition();
			virtual CIwFVec2 translatePosition(float scale);
			CIwFVec2 translateVector(CIwFVec2 v, CIwFVec2 s, N2FOriginPoint o, N2FScaleGroup g);
			CIwFVec2 translateVector(CIwFVec2 vector, CIwFVec2 size, float scale, N2FOriginPoint opoint, N2FScaleGroup group);

			CIwFVec2 unTranslateVector(CIwFVec2 vector, CIwFVec2 size, float scale, N2FOriginPoint opoint, N2FScaleGroup group);

			N2FOriginPoint originPoint;
			ScaleFactor scaleFactor;
			bool isVisible, isActive;
			N2FScaleGroup scaleGroup;
			CIwFVec2 pos, size;
		};
	}
}

#endif
